package com.Maykk.Demo11;


import java.util.function.Consumer;

/**
 * @ClassName: Consumer
 * @Description: TODO Consumer 消费者接口
 * @Author: MaykkStar@163.com
 */
public class ConsumerDemo {
    public static void main(String[] args) {
        operatorString("Maykk", str -> System.out.println("你的名字是：" + str));
        operatorString("Maykk", str -> System.out.println("你的名字反过来是：" + new StringBuilder(str).reverse()));
        Consumer<String> tConsumer = str -> System.out.println("你的名字是" + str);
        tConsumer.accept("Maykk");
        System.out.println("''''''''''''''''''''''''''''''''''''''''''");
        operatorString("多参消费者方法",
                str -> System.out.println("现在是多参方法输出：" + str),
                str -> System.out.println("把多参方法中的 str 逆序：" + new StringBuilder(str).reverse())
        );
    }

    public static void operatorString(String str, Consumer<String> con) {
        con.accept(str);
    }

    public static void operatorString(String str, Consumer<String> con01, Consumer<String> con02) {
        con01.accept(str);
        con02.accept(str);
    }
}
